<?php

/**
 * @category   My
 * @package    My_Controller
 */
class My_Controller_Plugin_FlashMessenger extends Zend_Controller_Plugin_Abstract
{
    public function routeStartup(Zend_Controller_Request_Abstract $request)
    {
       $request = Zend_Controller_Front::getInstance()->getRequest(); 
        $url = array( 
           $request->getActionName(), 
           $request->getControllerName(), 
           $request->getModuleName(), 

        ); 
    }
            
    public function preDispatch(Zend_Controller_Request_Abstract $request)
    {
        $view  = Zend_Controller_Action_HelperBroker::getStaticHelper('ViewRenderer')->view;
        $flash = Zend_Controller_Action_HelperBroker::getStaticHelper('FlashMessenger');

        if ($flash->hasMessages()) {
            $view->messages = $flash->getMessages();
//            $this->getResponse()->prepend('messages', $view->render('message.phtml'));
        } else {
            $view->messages = NULL;
        }
    }
}